package net.passClass;

import com.alibaba.fastjson.JSON;
import model.assessment.Question;
import model.hospital.Building;

import java.util.ArrayList;
import java.util.Collection;
import java.util.TreeSet;

public class PassBuildings extends PassData{
    public PassBuildings(boolean flag, TreeSet<Building> buildings , String message) {
        super(flag, message);
        this.setData(buildings);
    }

    public PassBuildings() {
    }

    public TreeSet<Building> getData() {
        TreeSet<Building> buildings = new TreeSet<Building>();
        ArrayList<Building> data = new ArrayList<Building>();
        data.addAll((Collection<? extends Building>) super.getData());

        for(int i = 0; i<data.size(); i++){
            Building aBuilding = JSON.parseObject(JSON.toJSONString(data.get(i)),Building.class);
            buildings.add(aBuilding);
        }
        return buildings;
    }
}
